import { request } from './request.js'
request.defaultData.baseUrl = 'http://cyjs.pzhkj.cn/'

export function getMyPlanList({ per_page, page, status }) {
  return new Promise((resolve, reject) => {
    request
      .ajax({
        path: 'api/optional/planMyList',
        method: 'POST',
        data: {
          per_page,
          page,
          status,
        },
        afterAjax: res => {
          resolve(res)
        },
      })
      .catch(err => {
        reject(err)
      })
  })
}

export function getYilouChart({ p_id, c_id }) {
  return new Promise((resolve, reject) => {
    request
      .ajax({
        path: 'api/optional/yilouChart',
        method: 'POST',
        data: {
          p_id,
          caipiao_id: c_id,
        },
        afterAjax: res => {
          resolve(res)
        },
      })
      .catch(err => {
        reject(err)
      })
  })
}
